<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>13-字符串新方法2</title>
</head>
<body>
    <script type="text/javascript">
        // repeat():返回新的字符串，表示将字符串重复指定次数返回
        console.log("say".repeat(2));  // saysay
        // padStart: 返回新的字符串，表示用参数字符串从头部(左侧)补全原字符串。
        // padEnd: 返回新的字符串，表示用参数字符串从尾部(右侧)补全原字符串
        console.log("h".padStart(5,'o'));  // "ooooh"
        console.log("h".padEnd(5,"o"));   // "hoooo"
        console.log("h".padStart(5));   // "    h"
    </script>
</body>
</html>